<!DOCTYPE html>
<html>
<head>
<title>明细查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../../include/resources.html">
<script type="text/javascript">
var dataGrid;
var winWidth =  800;
var winHeight = 280;

var kfVerifyTitle="客服提现审核";
var kfVerifyUrl="/modules/account/cash/accountcash/kfVerifyCashEditPage.html";
var kfVerifyWinParmeters = "'{0}','"+kfVerifyTitle+"',800,500,'"+kfVerifyUrl+"','确定'";
$(function() {
    var search = function (){
        var data = {};
        data.searchName = $("input[name='searchName']").val();
        data.startTime = $("input[name='startTime']").val();
        data.endTime = $("input[name='endTime']").val();
        data.accountType = $("select[name='accountType']").val();
        var options = $('#dataGrid').datagrid('options');
        data.page = options.pageNumber;
        data.rows =options.pageSize;
        $.ajax({
            url : '/modules/tpp/tppMerchantLog/baofoo/doQueryAccountDetails.html?randomTime=' + (new Date()).getTime(),
            dataType: "json",
            data:data,
            success : function(result){
                var r = result || {};
                if (r.hasError) {
                	$.messager.alert('Warning',r.message);
                } else {
                	$('#dataGrid').datagrid('loadData',{"total" : r.total,"rows" : r.rows});
                }
            }
        });
    }
    
	dataGrid = $('#dataGrid').datagrid({
		fit : true,
		fitColumns : true,
		border : false,
		pagination : true,
		sortOrder : 'desc',
		checkOnSelect : false,
		selectOnCheck : false,
		nowrap : false,
		singleSelect:true,
		pageList: [10, 20,30], 
		columns : [ [
			{ field: 'accountType', title: '类型', width: 80,
				formatter: function(value, row, index) {
                    if(row.accountType == "1") {
                        return "投标"
                    } else if (row.accountType == "2") {
                    	return "满标"
                    } else if (row.accountType == "3") {
                    	return "流标"
                    } else if (row.accountType == "4") {
                    	return "还款"
                    } else if (row.accountType == "5") {
                    	return "充值"
                    } else if (row.accountType == "6") {
                    	return "提现"
                    } else if (row.accountType == "7") {
                    	return "转账"
                    } else if (row.accountType == "8") {
                    	return "用户信息"
                    } else {
                        return "其他"
                    }
                }
			},
			{ field: 'userId', title: '托管ID', width: 100},
			{ field: 'accountName', title: '托管账户名', width: 80},
			{ field: 'createTime', title: '会员创建时间', width: 110},
			{ field: 'email', title: '邮箱', width: 80},
			{ field: 'orderId', title: '订单号', width: 100 },
			{ field: 'changeAmount', title: '变更金额', width: 80 },
			{ field: 'fee', title: '平台手续费', width: 80 },
			{ field: 'baofooFee', title: '第三方手续费', width: 80 },
			{ field: 'feeTakenOn', title: '手续费收取方', width: 80,
				formatter: function(value, row, index) {
                    if(row.feeTakenOn == "1") {
                        return "商户"
                    } else if (row.feeTakenOn == "2") {
                    	return "用户"
                    } else {
                        return ""
                    }
                }
			},
			{ field: 'time', title: '时间', width: 110},
			{ field: 'state', title: '状态', width: 80,
				formatter: function(value, row, index) {
                    if(row.state == "1") {
                        return "成功"
                    } else if (row.state == "0") {
                    	return "处理中/初始化/未授权"
                    } else if (row.state == "-1") {
                    	return "失败/已注销"
                    } else if (row.state == "5") {
                    	return "转账处理中"
                    } else {
                        return "其他"
                    }
                }
			}
		 ] ]
	});

	var dg = $('#dataGrid');
	var opts = dg.datagrid('options');
	var pager = dg.datagrid('getPager');
	pager.pagination({ 
		onSelectPage:function(pageNum, pageSize){
			opts.pageNumber = pageNum;
			opts.pageSize = pageSize;
			pager.pagination('refresh',{
				pageNumber:pageNum,
				pageSize:pageSize
			});
			search();
		}
	});
	
    //重新触发按钮
    $(".sBtn,.reloadIcon").click(function(){
        search();
    })
});
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<input type="text"  name="searchName" class="sInput" placeholder="输入用户名" autocomplete="off" onkeydown="if(event.keyCode == 13){search();}"/>
	            	<select name="accountType" id="accountType" >
			              <option value="1">投标</option>
			              <option value="2">满标</option>
			              <option value="3">流标</option>
			              <option value="4">还款</option>
			              <option value="5">充值</option>
			              <option value="6">提现</option>
			              <option value="7">转账</option>
			              <option value="8">用户信息</option>
			            </select>
                    <input type="text" placeholder="输入开始时间" name="startTime" onFocus="WdatePicker({readOnly:true})" class="searchTime"/>&nbsp;-&nbsp;<input type="text" placeholder="输入结束时间" name="endTime" onFocus="WdatePicker({readOnly:true})" class="searchTime"/>
                    <a href="javascript:void(0);" title="查询" class="sBtn" >查询</a>
	            	<a href="javascript:void(0);" class="reloadIcon" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
		</div>
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>